﻿namespace WebPacker.Tests.VersionGenerators
{
	using NUnit.Framework;
	using WebPacker.Helpers;
	using WebPacker.VersionGenerators;

	[TestFixture]
	public class LastModifiedVersionGeneratorTest : VersionGeneratorBaseTest
	{
		[Test]
		public void ConstructorTest()
		{
			Assert.AreEqual("lastModified", GetGenerator().Name);
		}

		[Test]
		public void GetNextVersionTest()
		{
			var generator = GetGenerator();
			var pack = GetTestPack();
			var lastModified = pack.GetLastModifiedTime();
			var expected = DateTimeHelper.ToTimestamp(lastModified).ToString("x");
			var actual = generator.GetNextVersion(pack);
			Assert.AreEqual(expected, actual);
		}

		protected override IVersionGenerator GetGenerator()
		{
			return new LastModifiedVersionGenerator();
		}
	}
}
